home *** CD-ROM | disk | FTP | other *** search
/ Gekkan Dennou Club 140 / Gekkan Dennou Club - 2000.1 Vol. 140 (Japan).7z / Gekkan Dennou Club - 2000.1 Vol. 140 (Japan) (Track 1).bin / tools / dshell / dsh333bs.lzh / def.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-08-10  |  6.1 KB  |  214 lines

  1. /*
  2.     dshell    v3
  3.  
  4.     定数定義、型定義等
  5. */
  6.  
  7. typedef unsigned char uchar;
  8. typedef unsigned short ushort;
  9.  
  10. #undef    NULL
  11. #define    NULL    ((void *)0)
  12.  
  13. #define    TRUE        1
  14. #define    FALSE        0
  15.  
  16.  
  17. /*    制御文字列 (内部表現)    */
  18. #define    CTRL_CHAR    '\x7f'        // <DEL>
  19. #define    NORM_CHAR    '\x18'        // ^X (12/24ドット表示末尾)
  20. #define    CUT_CHAR    'C'        // %CUT → DEL C
  21. #define    LARGE_CHAR    'L'        // %V%W → DEL L
  22. #define    SMALL_CHAR    'S'        // %V%W → DEL S
  23. #define    HR_CHAR        'K'        // ━ → DEL K ━
  24. #define    BOX_CHAR    'W'        // %box → DEL W
  25. #define    CTRL_IDSTR    "\x7f"
  26. #define    CUT_IDSTR    "\x7f""C"
  27. #define    LARGE_IDSTR    "\x7f""L"
  28. #define    SMALL_IDSTR    "\x7f""S"
  29.  
  30. #define    DUMMY_CHAR    CTRL_CHAR    // '◎'は一旦 DEL DEL に置換した上で
  31. #define    EXEC_CHAR    'X'        //     有効なものは DEL X に、それ以外は'◎'に再置換
  32. #define    VEXEC_CHAR    'x'        // 実行済み '◎'
  33. #define    TYPE_CHAR    '<'        // TYPE= → DEL <
  34. #define    NULTYPE_CHAR    '\0'        // Type= → DEL NUL
  35.  
  36. #define    FONT_CHAR    'F'
  37. #define    EFONT_CHAR    'f'
  38.  
  39. #define    NUM_BIAS    ((uchar)0x20)    // 数値をテキストに埋め込む際のゲタ
  40.  
  41.  
  42. /* テキスト色 */
  43. #define    TCOL1        ((24 << 11) + ( 0 << 6) + (31 << 1))    /* default よりも気持ち抑え目 */
  44. #define    TCOL2        ((10 << 11) + (31 << 6) + (10 << 1))    /* 赤 */
  45. #define    TCOL3        ((31 << 11) + (31 << 6) + (31 << 1))    /* default と同色 */
  46.  
  47.  
  48. /* dexec() 用フラグ (bit) */
  49. #define    DEX_WAIT    (1<<0)    /* 実行後、確認のクリックを要求する */
  50. #define    DEX_PSCR    (1<<1)    /* 実行後、画面を描き直す */
  51. #define    DEX_FKON    (1<<2)    /* 実行の間、ファンクション行を有効にする */
  52. #define    DEX_RETM    (1<<3)    /* 実行前、「exit で戻る」旨を表示 */
  53. #define    DEX_NCLR    (1<<4)    /* 実行時、画面を初期化しない */
  54. #define    DEX_NDOUT    (1<<4)    // 実行前の din() の呼び出しを抑制する (DEX_NCLR に同じ)
  55. #define    DEX_NDIN    (1<<5)    // 実行後の dout() の呼び出しを抑制する
  56. #define    DEX_SLNT    (1<<6)    // 裏にコンソールを切って実行する
  57. #define    DEX_GCLS    (1<<7)    // 画面を65536色モードに初期化のうえ、クリアする
  58. #define    DEX_GMODE    (1<<8)    // 実行後の画面モードに応じて DSHELL 側の画面モードを切り替える
  59. #define    DEX_SHELL    (1<<15)    // COMMAND.X を介する
  60.  
  61. #define    HIGH_SPEED    3    /* joystick,keyboard使用時のカーソル移動速度(x3) */
  62. #define    NOMAL_SPEED    1    /* joystick,keyboard使用時のカーソル移動速度(x1) */
  63.  
  64. #define    RW_HALF        12    /* line of realtime scroll window */
  65. #define    RW_FULL        30
  66.  
  67. #define    MAXSCRLIN    30    /* ページスクロール最大行数 */
  68. #define    DEFSCRLIN    MAXSCRLIN-2    /* ページスクロール行数default */
  69.  
  70.  
  71. /*
  72.     カットファイル関係
  73. */
  74. #define    CUTFILE        0
  75. #define    TITLESYS    1
  76.  
  77. #define    CUT_MAX        256    /* カットファイルの最大数 (≦4096) */
  78.  
  79. #define    BUF_X        128    /* 非圧縮部のビットパターンのMAX */
  80. #define    BUF_Y        16
  81.  
  82. #define    byteCount(x)    ((((x) - 1) >> 3) + 1)
  83. #define    lineCount(y)    ((((y) - 1) >> 4) + 1)
  84.  
  85. typedef uchar LINEBUF[BUF_X];
  86. typedef struct {
  87.     short dx, dy;
  88.     LINEBUF buffer[BUF_Y];
  89. } TEXTBUF;                /* TEXTPUT()用構造体FNTBUFのかわり */
  90.  
  91. #define    cutREVERSE    (1<<7)
  92. #define    cutDUP        (1<<6)
  93. #define    cutLEFT        (1<<5)
  94. #define    cutRIGHT    (1<<4)
  95.  
  96. typedef struct {
  97.     TEXTBUF *ptr;    // カットデータ本体へのポインタ
  98.     uchar *fname;    // カットファイル名
  99.     short x;    // x dot数
  100.     short y;    // y dot数
  101.     char type;    // 種別    0...CUT, 1...TITLE.SYS, -1...unknown
  102.     uchar flag;    // フラグ
  103. } CUT;
  104.  
  105. #define    POSPMAX        128    /* 128に根拠なし */
  106. #define    EXLEN        256    /* TYPE=~文字列の処理用バッファなどの長さ… */
  107.  
  108.  
  109. #define    printer_init()    INIT_PRN(0xFF,0xFF)
  110.  
  111.  
  112. /*
  113.     X68000の文字セット中の2バイト文字の1文字目かどうかを調べる
  114.     そうなら TRUE、違うなら FALSE を返す(ハズ)
  115. */
  116. #define    iskanji1(c)    ((signed char)(c) < 0\
  117.     && ((uchar)(c) < 0xa0 || (uchar)(c) >= 0xe0 && (uchar)(c) < 0xf6))
  118. #define    iskanji(c)    \
  119.     ((uchar)(c) >= 0x81 && (uchar)(c) < 0xa0 || (uchar)(c) >= 0xe0 && (uchar)(c) < 0xf0)
  120.  
  121.  
  122. #define    clr_kbf()    KFLUSHIO(-1)
  123.  
  124. #define    tab_on()    (BITSNS(0x02) & 0x01)
  125. #define    esc_on()    (BITSNS(0x00) & 0x02)
  126. #define    cr_on()        (BITSNS(0x03) & 0x20)
  127. #define    enter_on()    (BITSNS(0x09) & 0x40)
  128. #define    help_on()    (BITSNS(0x0a) & 0x10)
  129. #define    clr_on()    (BITSNS(0x07) & 0x80)
  130. #define    del_on()    (BITSNS(0x06) & 0x80)
  131.  
  132. #define    SHIFT_KEY    (1<<0)
  133. #define    CTRL_KEY    (1<<1)
  134. #define    OPT1_KEY    (1<<2)
  135. #define    OPT2_KEY    (1<<3)
  136. #define    shift_on()    (B_SFTSNS() & SHIFT_KEY)
  137. #define    ctrl_on()    (B_SFTSNS() & CTRL_KEY)
  138. #define    opt1_on()    (B_SFTSNS() & OPT1_KEY)
  139. #define    opt2_on()    (B_SFTSNS() & OPT2_KEY)
  140.  
  141. #define    LED_KANA    (1<<8)
  142. #define    LED_ROMA    (1<<9)
  143. #define    LED_CODEIN    (1<<10)
  144. #define    LED_CAPS    (1<<11)
  145. #define    LED_INS        (1<<12)
  146. #define    LED_ZENKAKU    (1<<14)
  147. #define    space_on()    (BITSNS(6) & (1<<5))
  148. #define    codein_on()    (B_SFTSNS() & LED_CODEIN)
  149. #define    kana_on()    (B_SFTSNS() & LED_KANA)
  150. #define    roma_on()    (B_SFTSNS() & LED_ROMA)
  151. #define    caps_on()    (B_SFTSNS() & LED_CAPS)
  152. #define    ins_on()    (B_SFTSNS() & LED_INS)
  153. #define    zenkaku_on()    (B_SFTSNS() & LED_ZENKAKU)
  154. #define    xf3_on()    (BITSNS(10) & (1<<7))
  155. #define    xf4_on()    (BITSNS(11) & (1<<0))
  156.  
  157. #define    CRTCR00    ((ushort *)0xe80000)    // CRTC R0
  158. #define    CRTCR01    ((ushort *)0xe80002)    // CRTC R1
  159. #define    CRTCR02    ((ushort *)0xe80004)    // CRTC R2
  160. #define    CRTCR03    ((ushort *)0xe80006)    // CRTC R3
  161. #define    CRTCR20    ((ushort *)0xe80028)    // CRTC R20
  162. #define CRTCR21 ((ushort *)0xe8002a)    // CRTC R21
  163. #define    VIDEOR0    ((ushort *)0xe82400)    // VIDEOコントローラ R0
  164. #define    VIDEOR1    ((ushort *)0xe82500)    // VIDEOコントローラ R1
  165. #define    VIDEOR2    ((ushort *)0xe82600)    // VIDEOコントローラ R2
  166.  
  167. #define    strEqu(s1,s2)    (strcmp((s1), (s2)) == 0)
  168. #define    strnEqu(s1,s2,n)    (strncmp((s1), (s2), (n)) == 0)
  169. #define    striEqu(s1,s2)    (strcmpi((s1), (s2)) == 0)
  170.  
  171. #define    cls()    B_CLR_AL()
  172.  
  173. typedef struct shellvar {
  174.     struct shellvar *next;
  175.     uchar name[0];    // '変数名','\0','定義内容','\0'
  176. } SHELLVAR;
  177.  
  178.  
  179. /*
  180.     sp を得る
  181. */
  182. #define    getSp() ({ \
  183.     void *sptr; \
  184.     asm("move.l sp,%0" : "=g"(sptr)); \
  185.     sptr; \
  186. })
  187.  
  188. /*
  189.     上位/下位 16 ビットを取り出す
  190. */
  191. #define lowWord(x) ((ushort)(x))
  192. #define    highWord(x) ({ \
  193.     int val = (x); \
  194.     asm( \
  195.     "clr.w    %0\n" \
  196.     "swap.w    %0\n" \
  197.     : "=d"(val) : "0"(val)); \
  198.     val; \
  199. })
  200.  
  201.  
  202. #define    FONTMAX    (0x7f-0x20+1)
  203. typedef struct {
  204.     uchar *pat;        // パターン本体へのポインタ
  205.     uchar *fname;    // ファイル名
  206.     uchar sect;        // 開始“区”(0...半角)
  207.     uchar size;        // 区単位のサイズ
  208. } FONT16;
  209.  
  210. typedef struct fontAdrTable {
  211.     uchar *table[95];
  212.     struct fontAdrTable *prev;
  213. } FNTADR_TABLE;
  214.